<template>
  <div class="_wrapper">
    <img class="_abs-c" style="width: 60%" :src="src_url" />
  </div>
</template>
<script>
import tool_ws from "@/tool/tool_ws";
import { getStreamUrl } from "./components/ApiHaikang.js";

export default {
  data() {
    return {
      src_url: "",
    };
  },
  async mounted() {
    let rtsp = await getStreamUrl(this.param("comCode"));
    // let ws = tool_ws.init_start(`ws://61.52.247.249:12030/${rtsp.url}`);
    let ws = tool_ws.init_start(`ws://61.52.247.249:12030/${rtsp.url}`);
    let images = [];
    ws.on_msg((msg) => {
      images.push(msg);
    });
    setInterval(() => {
      if (images.length > 10) {
        this.src_url = images.shift();
      }
    }, 30);
  },
};
</script>
<style lang=""></style>
